package com.ajie.slimming.ui;

import android.content.Context;
import android.content.SharedPreferences;


public class Preference {
	SharedPreferences mSharedPreferences;
	
	public Preference(Context context){
		mSharedPreferences = context.getSharedPreferences("settings", Context.MODE_PRIVATE);
	}
	
	private static Preference instance;
	
	public static Preference getInstance(){
		if(instance == null){
			instance = new Preference(SlimmingApplication.getBPContext());
		}
		return instance;
	}
	
	/** 蓝牙MAC地址Key */
	private final static String KEY_BLUETOOTH_MAC = "KEY_BLUETOOTH_MAC";
	/** 蓝牙MAC地址String */
	public	String bluetooth_address = ""/*"BF:03:E0:61:60:35"*/;
	/** 设置蓝牙MAC地址 */
	public void setBluetoothAddress(String bluetooth_address) {
		mSharedPreferences.edit().putString(KEY_BLUETOOTH_MAC, bluetooth_address).commit();
	}
	/** 返回蓝牙MAC地址 */
	public String getBluetoothAddress() {
		return mSharedPreferences.getString(KEY_BLUETOOTH_MAC, bluetooth_address);
	}
	
	
	/** 是否是第一次使用 */
	private	final static String FIRST_USE_KEY = "first_use_key";
	private boolean isFirstUse = true;
	
	public boolean getIsFirstUse() {
		return mSharedPreferences.getBoolean(FIRST_USE_KEY, isFirstUse);
	}
	
	public void setIsFirstUse(boolean isFirstUse) {
		mSharedPreferences.edit().putBoolean(FIRST_USE_KEY, isFirstUse).commit();
	}

}
